<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        #h1 {
            color: red;
        }

        .h1 {
            color: blue
        }
    </style>
</head>

<body>
    <div id="Application">
        <h1 v-bind:[prop]="name" v-if="show">蓝色标题</h1>
        <h1 id="h1" v-if="show">红色标题</h1>
        <!-- 这句加上有时候是不能正常渲染的 <h1 id="h1" class=h1 v-if="show">标题</h1> -->
        <input v-model.trim="content">
    </div>
    <script>
        // 定义一个Vue组件, 名为App
        const App = {
            data() {
                return {
                    show: true,
                    prop: "class",
                    name: "h1",
                    content: ""
                }
            }
        }
        Vue.createApp(App).mount("#Application") 
    </script>

</body>

</html>